using System.ComponentModel.DataAnnotations;
using GamFi.API.Domain.Common;

namespace GamFi.API.Domain.Entities;

/// <summary>
/// Сущность информации о пользователи
/// </summary>
public class UserInfo : BaseEntity
{
    /// <summary>
    /// Имя
    /// </summary>
    [MaxLength(25)]
    public string FirstName { get; set; } = default!;

    /// <summary>
    /// Фамилия
    /// </summary>
    [MaxLength(25)]
    public string LastName { get; set; } = default!;

    /// <summary>
    /// Отчество
    /// </summary>
    [MaxLength(25)]
    public string? Patronymic { get; set; }

    /// <summary>
    /// ИД страны
    /// </summary>
    public Guid CountryId { get; set; }

    /// <summary>
    /// Страна
    /// </summary>
    public Country Country { get; set; } = default!;

    /// <summary>
    /// ИД картинки
    /// </summary>
    public Guid? ImageId { get; set; }

    /// <summary>
    /// nav-prop
    /// </summary>
    public Image? Image { get; set; }

    /// <summary>
    /// Nav-prop
    /// </summary>
    public User User { get; set; } = default!;

    /// <summary>
    /// ИД пользователя
    /// </summary>
    public Guid UserId { get; set; }

    /// <summary>
    /// Сообщения пользователя
    /// </summary>
    public ICollection<Message>? Messages { get; set; }

    /// <summary>
    /// Обновить информацию
    /// </summary>
    public void UpdateInfo(UserInfo userInfo)
    {
        FirstName = userInfo.FirstName;
        LastName = userInfo.LastName;
        Patronymic = userInfo.Patronymic;
        CountryId = userInfo.CountryId;
    }
}